package cn.frt.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.frt.dao.ShopsMapper;
import cn.frt.paging.Page;
import cn.frt.pojo.Shops;
import cn.frt.pojo.Site;
import cn.frt.service.ShopsService;
@Service
public class ShopsServiceImpl implements ShopsService {
	@Resource
	private ShopsMapper shopsMapper;
	
	/*
	 * 注册运营商
	 * @see cn.frt.service.ShopsService#insertShops()
	 */
	@Override
	public int insertShops(Shops shops) {
		// TODO Auto-generated method stub
		return shopsMapper.insertShops(shops);
	}
	@Override
	public Shops shopsLogin(String shopsNumber, String shopsPwd) {
		if(shopsPwd!=null&&!shopsPwd.equals("")){
			Shops shops = shopsMapper.shopsLogin(shopsNumber);
			if(shops.getShopsPwd().equals(shopsPwd)){
				return shops;
			}
		}
		return null;
		
	}
	
	@Override
	public List<Shops> selectShops() {
		// TODO Auto-generated method stub
		return shopsMapper.selectShops();
	}
	@Override
	public List<Shops> selectShopsById(Integer shopsId) {
		// TODO Auto-generated method stub
		return shopsMapper.selectShopsById(shopsId);
	}
	@Override
	@Transactional
	public int updateShopsById(Shops shops) {
		System.out.print(shops.getShopsName()+"===============");
		// TODO Auto-generated method stub
		return  shopsMapper.updateShopsById(shops);
	}
	@Override
	public Site selectSite() {
		// TODO Auto-generated method stub
		return shopsMapper.selectSite();
	}
	@Override
	public int deleteShopsById(Integer shopsId) {
		// TODO Auto-generated method stub
		return shopsMapper.deleteShopsById(shopsId);
	}
/*
 * 查询shops数量
 * @see cn.frt.service.ShopsService#getShopsCount()
 */
	@Override
	public int getShopsCount() {
		return shopsMapper.getShopsCount();
	}
/*
 * 分页查询shops
 * @see cn.frt.service.ShopsService#shopsByPage(int, int)
 */
	@Override
	public List<Shops> shopsByPage(int pageNo, int pageSize) {
		
		return shopsMapper.shopsByPage(pageNo, pageSize);
	}


	
		

	

}
